import axios from "axios";
import ElementUI from 'element-ui';  //在js中用el还需要单独引入一下


export default {
    /**
     *
     * @param goods 请求参数
     * @returns {Promise<resolve>}
     */
    upPrice(goods) {
        return new Promise((resolve, reject) => {
            axios.post('/api/house/add', goods).then(res => {
                resolve(res.data)  //回调
                ElementUI.Notification.success('资金已入账!');
            }).catch(err => {
                reject(err.data)
                ElementUI.Notification.error('订购资金异常!');
                })
        });
    },
    getPrice(params){
        return new Promise((resolve, reject) =>{
            axios.get('/api/house/findPrice', {params: params}).then(res => {
                resolve(res.data.data);
                // ElementUI.Notification.success('!');
                }).catch(err => {
                    reject(err.data)
                })
        });
    },
    get7days(params){
        return new Promise((resolve, reject) =>{
            axios.get('/api/house/find7days', {params: params}).then(res => {
                resolve(res.data.data);
            }).catch(err => {
                reject(err.data)
            })
        });
    }
}
